<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>执法人员信息管理</title>
	<script src="../../js/header.js"></script>
	<style type="text/css">
		html, body, #lawperson {
			padding: 0px;
			margin: 0px;
			/*height: 100%;*/
		}
		#lawperson{
			border-top: 3px solid #0D9AFF;
			padding: 25px;
		}
		.tab-title{
			font-size: 16px;
			font-weight: bold;
			border-left: 4px solid #0D9AFF;
			font-family: PingFangSC-Medium;
			padding-left:10px;
			margin-bottom: 20px;
		}
		.el-dialog__footer {
			padding: 10px 20px 20px;
			text-align: center;
			-webkit-box-sizing: border-box;
			box-sizing: border-box;
		}
		.el-dialog__body {
			color: rgb(96, 98, 102);
			font-size: 14px;
			word-break: break-all;
			padding: 0px 20px;
		}
		#excel {
			display: none;
		}
		.el-input__inner {
			-webkit-appearance: none;
			background-color: #FFF;
			background-image: none;
			border-radius: 4px;
			border: 1px solid #DCDFE6;
			-webkit-box-sizing: border-box;
			box-sizing: border-box;
			color: #606266;
			display: inline-block;
			font-size: inherit;
			height: 30px;
			line-height: 30px;
			outline: 0;
			padding: 0 15px;
			-webkit-transition: border-color .2s cubic-bezier(.645,.045,.355,1);
			transition: border-color .2s cubic-bezier(.645,.045,.355,1);
		}
		/*#lawperson .el-input,
		#lawperson .el-select,
		#lawperson .el-input-number{
			width: 100%;
		}*/
		.listed .el-form-item__label{
			letter-spacing: 3px;
		}
		.el-textarea {
			width: 95%;
		}

		/* 搜索按钮样式修改 */
		#lawperson .el-button.is-circle.search_btn{
			position: absolute;
			right: 0;
			top: 0;
			border: 0;
			background: none;
		}
		#lawperson .el-button.is-circle.search_btn i{
			font-size: 17px;
		}
	</style>
</head>

<body>
<div v-cloak id="lawperson">
	<div style="margin-top: 10px;">
		<div style="margin-top: 10px;border-bottom:1px solid rgba(200,200,200,0.43);">
			<el-form :model="selectForm" :rules="rules" ref="selectForm" label-width="150px">
				<el-row>
					<el-col :span="6">
						<el-form-item label="姓名:" prop="" label-width="90px">
							<el-input v-model="selectForm.executorName" placeholder="" style="width: 300px;"></el-input>
						</el-form-item>
					</el-col>
					<el-col span="6">
						<el-form-item label="执法证号:" label-width="120px">
							<el-form-item prop="">
								<el-input v-model="selectForm.executorCode" placeholder="" style="width: 300px;"></el-input>
							</el-form-item>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="所属主体全称:" prop="" label-width="150px">
							<el-input v-model="selectForm.executorOrganization" placeholder="" style="width: 300px;"></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="6">
						<el-form-item label="职级:" prop="" label-width="90px">
							<el-form-item prop="">
								<el-select v-model="selectForm.executorLevel" placeholder="请选择职级" style="width: 300px;">
									<el-option label="省部级正职" value="1"></el-option>
									<el-option label="省部级副职" value="2"></el-option>
									<el-option label="厅局级正职（巡视员）" value="3"></el-option>
									<el-option label="厅局级副职（副巡视员）" value="4"></el-option>
									<el-option label="县处级正职（调研员）" value="5"></el-option>
									<el-option label="县处级副职（副调研员）" value="6"></el-option>
									<el-option label="乡科级正职（主任科员）" value="7"></el-option>
									<el-option label="乡科级副职（副主任科员）" value="8"></el-option>
									<el-option label="科员" value="9"></el-option>
									<el-option label="办事员" value="10"></el-option>
									<el-option label="其他" value="11"></el-option>
								</el-select>
							</el-form-item>
						</el-form-item>
					</el-col>
					<el-col :span="6">
						<el-form-item label="执法人员性质:" prop="" label-width="120px">
							<el-select v-model="selectForm.executorCharacter" placeholder="请选择执法人员性质" style="width: 300px;">
								<el-option label="公务员" value="1"></el-option>
								<el-option label="聘任制公务员" value="2"></el-option>
								<el-option label="事业编制工作人员" value="3"></el-option>
								<el-option label="企业人员" value="4"></el-option>
								<el-option label="执法辅助人员" value="5"></el-option>
							</el-select>
						</el-form-item>
					</el-col>					
					<div style="float: right;">
						<el-button type="primary" size="small" style="width: 60px;height: 30px;" @click="apply()">申请</el-button>
						<el-button type="primary" size="small" style="width: 60px;height: 30px;" @click="searchForm()">查询</el-button>
						<el-button type="warning" size="small" style="width: 60px;height: 30px;" @click="resetForm()">重置</el-button>
					</div>
				</el-row>
			</el-form>
		</div>

		<el-table :data="tableData" border style="width: 100%;margin-top: 35px;" :header-cell-style="{background:'#eef1f6',color:'#606266'}">
			<!--<el-table-column type="selection" ></el-table-column>-->
			<el-table-column
					prop="executorName"
					label="姓名"
					width="150"
					align="center" >
			</el-table-column>
			<el-table-column
					prop="executorSex"
					label="性别"
					width="150"
					align="center">
				<template scope="scope">
					<span v-if="scope.row.executorSex==1">未知的性别</span>
					<span v-if="scope.row.executorSex==2">男</span>
					<span v-if="scope.row.executorSex==3">女</span>
					<span v-if="scope.row.executorSex==4">女性改(变)为男性</span>
					<span v-if="scope.row.executorSex==5">男性改(变)为女性</span>
					<span v-if="scope.row.executorSex==6">未说明的类别</span>
				</template>
			</el-table-column>
			<el-table-column
					prop="executorCode"
					label="执法证号"
					width="250"
					align="center">
			</el-table-column>
			<el-table-column
					prop="executorOrganization"
					label="所属主体全称"
					width="300"
					align="center">
			</el-table-column>
			<el-table-column
					prop="executorLevel"
					label="职级"
					width="250"
					align="center">
					<template scope="scope">
						<span v-if="scope.row.executorLevel==1">省部级正职</span>
						<span v-if="scope.row.executorLevel==2">省部级副职</span>
						<span v-if="scope.row.executorLevel==3">厅局级正职（巡视员）</span>
						<span v-if="scope.row.executorLevel==4">厅局级副职（副巡视员）</span>
						<span v-if="scope.row.executorLevel==5">县处级正职（调研员）</span>
						<span v-if="scope.row.executorLevel==6">县处级副职（副调研员）</span>
						<span v-if="scope.row.executorLevel==7">乡科级正职（主任科员）</span>
						<span v-if="scope.row.executorLevel==8">乡科级副职（副主任科员）</span>
						<span v-if="scope.row.executorLevel==9">科员</span>
						<span v-if="scope.row.executorLevel==10">办事员</span>
						<span v-if="scope.row.executorLevel==11">其他</span>
					</template>
			</el-table-column>
			<el-table-column
					label="操作"
					width=""
					align="center">
				<template slot-scope="scope">
					<el-button type="" size="mini" @click="view(scope.$index,scope.row)">查看</el-button>
					<el-button type="primary" size="mini" @click="edit(scope.$index,scope.row)">修改</el-button>
					<el-button type="danger" size="mini" @click="del(scope.$index,scope.row)">删除</el-button>
				</template>
			</el-table-column>
		</el-table>
		<div style="overflow: hidden;">
			<div class="pagination">
				<el-pagination
						@size-change="handleSizeChange"
						@current-change="handleCurrentChange"
						:current-page="currentPage"
						:page-sizes="[10, 20, 30, 40]"
						:page-size="pagesize"
						background
						layout="total, sizes,prev, pager, next"
						:total="tableTotal"
						prev-text="上一页"
						next-text="下一页">
				</el-pagination>
			</div>
		</div>

		<el-dialog title="" :visible.sync="dialogForm" center fullscreen>
			<div style="margin-top: 10px;">
				<el-form :model="lawperson" :rules="rules" ref="lawperson" label-width="140px">
					<!--执法人员信息表-->
					<el-row>
						<el-col :span="4" class="tab-title">
							执法人员信息表
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="5">
							<el-form-item label="姓名:" prop="executorName">
								<el-input v-model="lawperson.executorName" placeholder="" :disabled="formDisabled"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="性别:" prop="executorSex" label-width="65px">
								<el-select v-model="lawperson.executorSex" placeholder="请选择性别" :disabled="formDisabled">
									<el-option label="未知的性别" value="1"></el-option>
									<el-option label="男" value="2"></el-option>
									<el-option label="女" value="3"></el-option>
									<el-option label="女性改(变)为男性" value="4"></el-option>
									<el-option label="男性改(变)为女性" value="5"></el-option>
									<el-option label="未说明的类别" value="6"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="5">
							<el-form-item label="出生日期:" prop="executorBirthday" label-width="93px">
								<el-date-picker
										type="date"
										placeholder="选择日期"
										v-model="lawperson.executorBirthday"
										:disabled="formDisabled"
										value-format="yyyy-MM-dd"
										style="width: 100%;">
								</el-date-picker>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col span="5">
							<el-form-item label="执法证号:" prop="executorCode">
								<el-input v-model="lawperson.executorCode" placeholder="" :disabled="formDisabled"></el-input>
							</el-form-item>
						</el-col>
						<el-col span="17">
							<el-form-item label="所属主体(受委托组织)全称:" prop="executorOrganization" label-width="200px">
								<el-input v-model="lawperson.executorOrganization" placeholder="" :disabled="formDisabled"></el-input>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="5">
							<el-form-item label="联系电话:" prop="executorPhoneNum">
								<el-input v-model="lawperson.executorPhoneNum" placeholder="" :disabled="formDisabled"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="民族:" prop="executorNationality" label-width="65px">
								<el-select v-model="lawperson.executorNationality" placeholder="请选择民族" :disabled="formDisabled">
									<el-option
										v-for="item in nationData"
										:key="item.appId"
										:label="item.dictName"
										:value="item.dictName">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="5">
							<el-form-item label="最高学历:" prop="executorEducation" label-width="93px">
								<el-select v-model="lawperson.executorEducation" placeholder="请选择最高学历" :disabled="formDisabled" style="width: 100%;">
									<el-option
										v-for="item in educationData"
										:key="item.appId"
										:label="item.dictName"
										:value="item.dictName">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="5">
							<el-form-item label="政治面貌:" prop="executorPoliticStatus">
								<el-select v-model="lawperson.executorPoliticStatus" placeholder="请选择政治面貌" style="width: 100%;" :disabled="formDisabled">
									<el-option label="中共党员" value="1"></el-option>
									<el-option label="中共预备党员" value="2"></el-option>
									<el-option label="共青团员" value="3"></el-option>
									<el-option label="民革党员" value="4"></el-option>
									<el-option label="民盟盟员" value="5"></el-option>
									<el-option label="民建会员" value="6"></el-option>
									<el-option label="民进会员" value="7"></el-option>
									<el-option label="农工党党员" value="8"></el-option>
									<el-option label="致公党党员" value="9"></el-option>
									<el-option label="九三学社社员" value="10"></el-option>
									<el-option label="台盟盟员" value="11"></el-option>
									<el-option label="无党派人士" value="12"></el-option>
									<el-option label="群众" value="12"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="17">
							<el-form-item label="身份证号:" prop="executorIdCard" label-width="93px">
								<el-input v-model="lawperson.executorIdCard" placeholder="" :disabled="formDisabled"></el-input>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="5">
							<el-form-item label="职级:" prop="executorLevel">
								<el-select v-model="lawperson.executorLevel" placeholder="请选择职级" style="width: 100%;" :disabled="formDisabled">
									<el-option label="省部级正职" value="1"></el-option>
									<el-option label="省部级副职" value="2"></el-option>
									<el-option label="厅局级正职（巡视员）" value="3"></el-option>
									<el-option label="厅局级副职（副巡视员）" value="4"></el-option>
									<el-option label="县处级正职（调研员）" value="5"></el-option>
									<el-option label="县处级副职（副调研员）" value="6"></el-option>
									<el-option label="乡科级正职（主任科员）" value="7"></el-option>
									<el-option label="乡科级副职（副主任科员）" value="8"></el-option>
									<el-option label="科员" value="9"></el-option>
									<el-option label="办事员" value="10"></el-option>
									<el-option label="其他" value="11"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="10">
							<el-form-item label="是否监督人员:" prop="executorSuperviseStatus" label-width="120px">
								<!--<el-select v-model="lawperson.executorSuperviseStatus" placeholder="请选择是否监督人员" :disabled="formDisabled">
									<el-option label="是" value="1"></el-option>
									<el-option label="否" value="2"></el-option>
								</el-select>-->
								<el-radio-group v-model="lawperson.executorSuperviseStatus"  :disabled="formDisabled">
									<el-radio label="1">是</el-radio>
									<el-radio label="2">否</el-radio>
								</el-radio-group>
							</el-form-item>
						</el-col>
						<el-col :span="8">
							<el-form-item label="是否具有法律职业资格:" prop="executorLegalQualification" label-width="177px">
								<!--<el-select v-model="lawperson.executorLegalQualification" placeholder="请选择是否具有法律职业资格" :disabled="formDisabled">
									<el-option label="是" value="1"></el-option>
									<el-option label="否" value="2"></el-option>
								</el-select>-->
								<el-radio-group v-model="lawperson.executorLegalQualification"  :disabled="formDisabled">
									<el-radio label="1">是</el-radio>
									<el-radio label="2">否</el-radio>
								</el-radio-group>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="5">
							<el-form-item label="执法人员性质:" prop="executorCharacter">
								<el-select v-model="lawperson.executorCharacter" placeholder="请选择执法人员性质" style="width: 100%;" :disabled="formDisabled">
									<el-option label="公务员" value="1"></el-option>
									<el-option label="聘任制公务员" value="2"></el-option>
									<el-option label="事业编制工作人员" value="3"></el-option>
									<el-option label="企业人员" value="4"></el-option>
									<el-option label="执法辅助人员" value="5"></el-option>
								</el-select>
							</el-form-item>
						</el-col>
						<el-col :span="6">
							<el-form-item label="发证机关:" prop="executorCertifyingAuthority" label-width="93px">
								<el-input v-model="lawperson.executorCertifyingAuthority" placeholder="请输入执法人员执法证的发证机关名称" :disabled="formDisabled"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="7">
							<el-form-item label="学历专业:" prop="executorMajor" label-width="93px">
								<el-input v-model="lawperson.executorMajor" placeholder="请输入执法人员的学历专业，如法律等" :disabled="formDisabled"></el-input>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="24">
							<el-form-item label="执法区域:" v-model="lawperson.executorArea" prop="executorArea">
								<el-col :span="4">
									<el-form-item prop="checkprovinceValue">
										<el-select v-model="checkprovinceValue" placeholder="请选择省" @change="chooseProvince" :disabled="formDisabled">
											<el-option
													v-for="item in provinceData"
													:key="item.code"
													:label="item.name"
													:value="item.name">
											</el-option>
										</el-select>
									</el-form-item>
								</el-col>
								<el-col span="0.5" style="color: rgb(192, 204, 218);text-align: center;">
									<span>—</span>
								</el-col>
								<el-col :span="4">
									<el-form-item prop="checkcityValue">
										<el-select v-model="checkcityValue" placeholder="请选择市" @change="chooseCity" :disabled="formDisabled">
											<el-option
													v-for="item in cityData"
													:key="item.code"
													:label="item.name"
													:value="item.name">
											</el-option>
										</el-select>
									</el-form-item>
								</el-col>
								<el-col span="0.5" style="color: rgb(192, 204, 218);text-align: center;">
									<span>—</span>
								</el-col>
								<el-col :span="4">
									<el-form-item prop="checkareaValue">
										<el-select v-model="checkareaValue" @change="chooseArea" placeholder="请选择区、县" :disabled="formDisabled">
											<el-option
													v-for="item in areaData"
													:key="item.code"
													:label="item.name"
													:value="item.name">
											</el-option>
										</el-select>
									</el-form-item>
								</el-col>
								<el-col span="0.5" style="color: rgb(192, 204, 218);text-align: center;">
									<span>—</span>
								</el-col>
								<el-col :span="7">
									<el-form-item>
										<el-input v-model="checkdetailAddress" placeholder="填写详细地址" :disabled="formDisabled"></el-input>
									</el-form-item>
								</el-col>

							</el-form-item>
						</el-col>

					</el-row>
					<el-row>
						<el-col :span="8">
							<el-form-item label="证件有效期至:" prop="executorCardInDate">
								<!--<el-input v-model="lawperson.executorCardInDate" placeholder="请输入执法人员的执法证有效期" :disabled="formDisabled"></el-input>-->
								<el-date-picker
									v-model="lawperson.executorCardInDate"
									type="date"
									value-format="yyyy-MM-dd"
									placeholder="请选择执法人员的执法证有效期至"
									:disabled="formDisabled"
									style="width: 360px">
								</el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="5">
							<el-form-item label="执法类别:" prop="executorCategory" label-width="93px">
								<el-input v-model="lawperson.executorCategory" placeholder="" :disabled="formDisabled"></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="5">
							<el-form-item label="所属机构:" prop="executorLocation" label-width="93px">
								<el-select v-model="lawperson.executorLocation" placeholder="请选择所属机构" :disabled="formDisabled" style="width: 100%;">
									<el-option
											v-for="item in orgData"
											:key="item.appId"
											:label="item.dictName"
											:value="item.dictName">
									</el-option>
								</el-select>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row>
						<el-col :span="22">
							<div style="float:right;">
								<el-button v-show="showOnSubmit" type="primary" size="small" style="width: 60px;height: 30px;" @click="onSubmit()">提交</el-button>
								<el-button v-show="showOnReplace" type="primary" size="small" style="width: 60px;height: 30px;" @click="onReplace()">修改</el-button>
								<el-button type="info" size="small" style="width: 60px;height: 30px;" @click="dialogForm = false;clearForm()">取消</el-button>
							</div>
						</el-col>
					</el-row>
				</el-form>
			</div>
		</el-dialog>
	</div>
</div>
<script>
    var vm = new Vue({
        el: '#lawperson',
        data() {
            //验证数值为非负
            /*let checkId= (rule, value, callback)=>{
                if(!checkCard(value)){
                    callback(new Error('请输入正确的身份证号码'));
                }else {
                    callback();
                }
            }*/
            return {
                currentPage: 1, //默认显示页面为1
                pagesize: 10, // 每页的数据条数
                tableTotal:'',
                provinceData: [],
                cityData: [],
                areaData: [],
				nationData: [], // 民族
                educationData: [
                    {
                        appId: '',
                        dictName: ''
                    }
				], // 最高学历
				orgData:[],//所属机构
				lawperson: {
                    id: '',// 表单id
                    executorName: '',
                    executorSex: '',
                    executorCode: '',
                    executorBirthday: '',
                    executorPoliticStatus: '',
                    executorLevel: '',
                    executorOrganization: '',
                    executorNationality: '',
                    executorEducation: '',
                    executorPhoneNum: '',
                    executorSuperviseStatus: 1,
                    executorIdCard: '',
                    executorLegalQualification: 1,
                    executorCharacter: '',
                    executorMajor: '',
                    executorCertifyingAuthority: '',
                    executorArea: '',
                    executorCategory: '',
                    executorCardInDate: '',
                    executorLocation:''
                },
                formDisabled: false,
                rules: {
                    executorName: [{
                        required: true,
                        message: '请输入执法人员姓名',
                        trigger: 'blur'
                    }],
                    executorSex: [{
                        required: true,
                        message: '请输入执法人员性别',
                        trigger: 'blur'
                    }],
                    executorCode: [{
                        required: true,
                        message: '请输入执法证号',
                        trigger: 'blur'
                    }],
                    executorBirthday: [{
                        required: true,
                        message: '请输入出生日期',
                        trigger: 'blur'
                    }],
                    executorPoliticStatus: [{
                        required: false,
                        message: '请输入政治面貌',
                        trigger: 'blur'
                    }],
                    executorLevel: [{
                        required: true,
                        message: '请输入职级',
                        trigger: 'blur'
                    }],
                    executorOrganization: [{
                        required: true,
                        message: '请输入所属主体全称',
                        trigger: 'blur'
                    }],
                    executorNationality: [{
                        required: true,
                        message: '请输入民族',
                        trigger: 'blur'
                    }],
                    executorEducation: [{
                        required: true,
                        message: '请输入最高学历',
                        trigger: 'blur'
                    }],
                    executorPhoneNum: [{
                        required: false,
                        message: '请输入联系电话',
                        trigger: 'blur'
                    }],
                    executorSuperviseStatus: [{
                        required: true,
                        message: '请选择是否监督人员',
                        trigger: 'blur'
                    }],
                    executorIdCard: [{
                        required: true,
                        message: '请输入身份证号',
                        trigger: 'blur'
                    },,{
                        validator: checkId,
                        //message: '联系电话不合法',
                        trigger: 'blur'
                    }
					],
                    executorLegalQualification: [{
                        required: false,
                        message: '请选择是否具有法律职业资格',
                        trigger: 'blur'
                    }],
                    executorCharacter: [{
                        required: true,
                        message: '请输入执法人员性质',
                        trigger: 'blur'
                    }],
                    executorMajor: [{
                        required: false,
                        message: '请输入学历专业',
                        trigger: 'blur'
                    }],
                    executorCertifyingAuthority: [{
                        required: false,
                        message: '请输入发证机关',
                        trigger: 'blur'
                    }],
                    executorArea: [{
                        required: false,
                        message: '请输入执法区域',
                        trigger: 'blur'
                    }],
                    executorCategory: [{
                        required: false,
                        message: '请输入执法类别',
                        trigger: 'blur'
                    }],
                    executorCardInDate: [{
                        required: false,
                        message: '请输入证件有效期',
                        trigger: 'blur'
                    }],
                    executorLocation: [{
                        required: true,
                        message: '请输入所属机构',
                        trigger: 'blur'
                    }]
                },
                dialogForm: false,
                selectForm: {
                    executorName: '',
                    executorCode: '',
                    executorOrganization: '',
                    executorLevel: '',
                    executorCharacter: '',
                    executorEducation: ''
                },
                companyInformation: [],
                currentRow: null,
                tableData: [],
                showOnSubmit: true,
                showOnReplace: false,
                checkprovinceValue:'',
                checkcityValue:'',
                checkareaValue:'',
                checkdetailAddress: ''
            }
        },
        created() {
            /* 地区加载数据 */
            axios.get('../../json/ChinaCity.json').then(res => {
                this.provinceData = res.data;
			}).catch(e => {
					this.$message.error("网络连接超时");
			})

			/* 民族加载数据 */
            axios.post('/dzjap/dict/getdict/d_nationality').then(res => {
                this.nationData = res.data.data.result;
			}).catch(e => {
				this.$message.error("网络连接超时");
			})

   			/* 最高学历加载数据 */
            axios.post('/dzjap/dict/getdict/d_education').then(res => {
                this.educationData = res.data.data.result;
			}).catch(e => {
				this.$message.error("网络连接超时");
			})
            axios.post('/dzjap/dict/getdict/d_org').then(res => {
                this.orgData = res.data.data.result;
            }).catch(e => {
                this.$message.error("网络连接超时");
            })
        },
        mounted(){
            this.getData();
        },
        methods: {
            getData() {
                var pagesize = this.pagesize;
                var pageno = this.currentPage;

                axios({
                    method: 'get',
                    url: '/dzjap/executorInfo/listexecutorinfo',
                    params: {
                        pageSize: pagesize,
                        pageNo: pageno
                    }
                })
				.then(response => {
					let data = response.data;
					if (data.code == 200) {
						let dataInformation = data.data.results;
						this.tableTotal = data.data.total;// 数据长度

						this.tableData = dataInformation;
					} else {
						this.$message.error(data.msg);
					}
				})
				.catch(function (error) {
					console.log(error);
				});
            },
            // 表单提交
            onSubmit() {
                this.lawperson.executorArea = this.checkprovinceValue + "-" + this.checkcityValue + "-"
					+ this.checkareaValue + "-" + this.checkdetailAddress;
                axios({
                    method: 'post',
                    url: '/dzjap/executorInfo/addexecutorinfo',
                    data: this.lawperson
                })
                .then((response) => {
                    let data = response.data;
                    if (data.code == 200) {
                        this.dialogForm = false;
                        this.$message({
                            type: 'success',
                            message: '添加成功!'
                        });
                        this.getData();
                    } else {
                        this.$message.error(data.msg);
                    }
                });
            },
            // 表单修改
            onReplace(){
                this.lawperson.executorArea = this.checkprovinceValue + "-" + this.checkcityValue + "-"
                    + this.checkareaValue + "-" + this.checkdetailAddress;
                axios({
                    method: 'post',
                    url: '/dzjap/executorInfo/updexecutorinfo',
                    data: this.lawperson
                })
                .then((response) => {
                    let data = response.data;
                    if (data.code == 200) {
                        this.dialogForm = false;
                        this.$message({
                            type: 'success',
                            message: '修改成功!'
                        });
                        this.getData();
                    } else {
                        this.$message.error(data.msg);
                    }
                });
            },
            clearForm(){
                this.lawperson.executorName = '';
                this.lawperson.executorSex = '';
                this.lawperson.executorCode = '';
                this.lawperson.executorOrganization = '';
                this.lawperson.executorPhoneNum = '';
                this.lawperson.executorIdCard = '';
                this.lawperson.executorLevel = '';
                this.lawperson.executorBirthday = '';
				this.lawperson.executorPoliticStatus = '';
				this.lawperson.executorNationality = '';
				this.lawperson.executorEducation = '';
				this.lawperson.executorSuperviseStatus = 1;
				this.lawperson.executorLegalQualification = 1;
				this.lawperson.executorCharacter = '';
				this.lawperson.executorMajor = '';
				this.lawperson.executorCertifyingAuthority = '';
				this.lawperson.executorArea = '';
				this.lawperson.executorCategory = '';
				this.lawperson.executorCardInDate = '';
                this.lawperson.executorLocation = '';

				this.checkprovinceValue = '';
				this.checkcityValue = '';
				this.checkareaValue = '';
				this.checkdetailAddress = '';

                
                /*this.$nextTick(()=>{
                	this.$refs['lawperson'].resetField();
                })*/
            },
            handleChange(value) {
                console.log(value);
            },
            apply(){
                this.dialogForm = true;
                this.showOnSubmit = true;
                this.showOnReplace = false;

                this.clearForm();

                this.formDisabled = false;
            },
            /* 单选搜索表单 */
            selectCurrentChange(val){
                this.currentRow = val;
            },
            /* 列表页搜索 */
            searchForm() {
                var pagesize = this.pagesize;
                var pageno = this.currentPage;

                axios({
                    method: 'get',
                    url: '/dzjap/executorInfo/getlistexecutorinfo',
                    params: {
                        pageSize: pagesize,
                        pageNo: pageno,
                        executorName: this.selectForm.executorName,
                        executorCode: this.selectForm.executorCode,
                        executorOrganization: this.selectForm.executorOrganization,
                        executorLevel: this.selectForm.executorLevel,
                        executorCharacter: this.selectForm.executorCharacter,
                        executorEducation: this.selectForm.executorEducation
                    }
                })
                .then(response => {
                    let data = response.data;
                    console.log(data);
                    if (data.code == 200) {
                        let dataInformation = data.data.results;
                        this.tableTotal = data.data.total;// 数据长度

                        this.tableData = dataInformation;
                    } else {
                        this.$message.error(data.msg);
                    }
                })
                .catch(function (error) {
                    console.log(error);
                });
            },
            /* 列表页重置 */
            resetForm(formName) {
                this.selectForm.executorName = '';
				this.selectForm.executorCode = '';
                this.selectForm.executorOrganization = '',
                this.selectForm.executorLevel = '',
                this.selectForm.executorCharacter = '',
				this.selectForm.executorEducation = ''
           		/*this.$nextTick(() => {
               		this.$refs['selectForm'].resetField();
               	})*/

                this.getData();
            },
            //每页下拉显示数据
            handleSizeChange(size) {
                this.pagesize = size;
                this.getData();
                /*console.log(this.pagesize) */
            },
            //点击第几页
            handleCurrentChange(currentPage) {
                this.currentPage = currentPage;
                this.getData();
            },
            // 设置允许填写和不允许填写
            checkDisabled(n){
                if(n){
                    this.formDisabled = true;
                }else{
                    this.formDisabled = false;
                }
            },
            /* 选择省份 */
            chooseProvince(value) {
                this.checkcityValue = '';
                this.checkareaValue = '';
                this.cityData = [];
                this.areaData = [];
                this.provinceData.map(e => {//遍历数据
                    if (value == e.name) {
                    this.cityData = e.cityList;
                    return;
                }
            })
                console.log(value)
                this.checkprovinceValue = value;
//              this.editareaearthquake.recordProjectAddress = value;
            },
            /* 选择城市 */
            chooseCity(value) {
                this.checkareaValue = '';
                this.cityData.map(e => {//遍历数据
                    if (value == e.name) {
                    this.areaData = e.areaList;
                    return;
                }
            })
                console.log(value)
                this.checkcityValue = value;
            },
            /* 选择区域 */
            chooseArea(value) {
                console.log(value)
                this.checkareaValue = value;
                this.lawperson.executorArea = this.checkprovinceValue + "-" + this.checkcityValue + "-" + this.checkareaValue;
                console.log(this.lawperson.executorArea)
            },
            // 删除
            del(index,row){
                var id = row.id;

                this.$confirm('确定要删除吗?', '提示', {
                    cancelButtonText: '取消',
                    confirmButtonText: '确定',
                    type: 'warning'
                }).then(() => {
                    axios({
                        method: 'post',
                        url: '/dzjap/executorInfo/delexecutorinfo/' + id
                    })
					.then(response => {
						let data = response.data;

						if (data.code == 200) {
							// 确认删除
							this.$message({
								type: 'success',
								message: '删除成功!'
							});
							this.getData();
						} else {
							this.$message.error(data.msg);
						}
					})
					.catch(function (error) {
						console.log(error);
					});
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '取消删除'
                    });
                });
            },
            // 查看
            view(index,row){
                this.dialogForm = true;
                this.showOnReplace = false;
                this.showOnSubmit = false;

                this.showInformationView(index,row);
                this.checkDisabled(true);
            },
            // 修改
            edit(index,row){
                this.dialogForm = true;
                this.showOnReplace = true;
                this.showOnSubmit = false;

                this.showInformation(index,row);
                this.checkDisabled(false);
            },

            // 公共方法查看 -- 身份证号加密显示
            showInformationView(index,row){
                console.log(row);

                axios({
                    method: 'get',
                    url: '/dzjap/executorInfo/getexecutorinfo',
                    params: {
                        executorid: row.id
                    }
                })
                    .then(response => {
                        let data = response.data;
                        if (data.code == 200) {
                            let rowdata = response.data.data;
                            this.clearForm(); // 重置
                            var arr = rowdata.executorArea.split("-");
                            this.checkprovinceValue = arr[0];
                            this.checkcityValue = arr[1];
                            this.checkareaValue = arr[2];
                            this.checkdetailAddress = arr[3];

                            this.lawperson = rowdata;
                            // 执法人员身份证号加密
                            if(this.lawperson.executorIdCard != "") {
                                this.lawperson.executorIdCard = enctryptIdcard(this.lawperson.executorIdCard);
                            }

                        } else {
                            this.$message.error(data.msg);
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },

            // 公共方法--查看
            showInformation(index,row){
                console.log(row);

                axios({
                    method: 'get',
                    url: '/dzjap/executorInfo/getexecutorinfo',
                    params: {
                        executorid: row.id
                    }
                })
				.then(response => {
					let data = response.data;
					if (data.code == 200) {
						let rowdata = response.data.data;
						this.clearForm(); // 重置
                        var arr = rowdata.executorArea.split("-");
                        this.checkprovinceValue = arr[0];
                        this.checkcityValue = arr[1];
                        this.checkareaValue = arr[2];
                        this.checkdetailAddress = arr[3];
						this.lawperson = rowdata;
						axios.get('../../json/ChinaCity.json').then(res=>{
		                	this.provinceData = res.data;
		                    this.provinceData.map(e=>{//遍历数据
			                    if( this.checkprovinceValue == e.name){
				                    this.cityData = e.cityList;
				                    this.cityData.map(e=>{//遍历数据
					                    if( this.checkcityValue == e.name){
						                    this.areaData = e.areaList;
						                    return;
						                }
						            })
				                    return;
				                }
				            })
						}).catch(e => {
							this.$message.error("网络连接超时");
						})
					} else {
						this.$message.error(data.msg);
					}
				})
				.catch(function (error) {
					console.log(error);
				});
            }
        }
    })
</script>
</body>
</html>